home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 1.iso / dist / fw_teTeX.idb / usr / freeware / share / texmf / dvips / psfrag / psfrag.pro.z / psfrag.pro
Text File  |  2001-01-10  |  5KB  |  156 lines

  1. %%
  2. %% This is file `psfrag.pro',
  3. %% generated with the docstrip utility.
  4. %%
  5. %% The original source files were:
  6. %%
  7. %% psfrag.dtx  (with options: `filepro')
  8. %% 
  9. %% Copyright (c) 1996 Craig Barratt, Michael C. Grant, and David Carlisle.
  10. %% All rights reserved.
  11. %% 
  12. %% This file is part of the PSfrag package.
  13. %% 
  14. userdict begin
  15. /PSfragLib 90 dict def
  16. /PSfragDict 6 dict def
  17. /PSfrag { PSfragLib begin load exec end } bind def
  18. end
  19. PSfragLib begin
  20. /RO /readonly      load def
  21. /CP /currentpoint  load def
  22. /CM /currentmatrix load def
  23. /B { bind RO def } bind def
  24. /X { exch def } B
  25. /MD { { X } forall } B
  26. /OE { end exec PSfragLib begin } B
  27. /S false def
  28. /tstr 8 string def
  29. /islev2 { languagelevel } stopped { false } { 2 ge } ifelse def
  30. [ /sM /tM /srcM /dstM /dM /idM /srcFM /dstFM ] { matrix def } forall
  31. sM currentmatrix RO pop
  32. dM defaultmatrix RO idM invertmatrix RO pop
  33. srcFM identmatrix pop
  34. /Hide { gsave { CP } stopped not newpath clip { moveto } if } B
  35. /Unhide { { CP } stopped not grestore { moveto } if } B
  36. /setrepl islev2 {{ /glob currentglobal def true setglobal array astore
  37.                    globaldict exch /PSfrags exch put glob setglobal }}
  38.                 {{ array astore /PSfrags X }} ifelse B
  39. /getrepl islev2 {{ globaldict /PSfrags get aload length }}
  40.                 {{ PSfrags aload length }} ifelse B
  41. /convert {
  42.    /src X src length string
  43.    /c 0 def src length {
  44.       dup c src c get dup 32 lt { pop 32 } if put /c c 1 add def
  45.    } repeat
  46. } B
  47. /Begin {
  48.     /saver save def
  49.     srcFM exch 3 exch put
  50.     0 ne /debugMode X 0 setrepl
  51.     dup /S exch dict def { S 3 1 roll exch convert exch put } repeat
  52.     srcM CM dup invertmatrix pop
  53.     mark { currentdict { end } stopped { pop exit } if } loop
  54.     PSfragDict counttomark { begin } repeat pop
  55. } B
  56. /End {
  57.     mark { currentdict end dup PSfragDict eq { pop exit } if } loop
  58.     counttomark { begin } repeat pop
  59.     getrepl saver restore
  60.     7 idiv dup /S exch dict def {
  61.         6 array astore /mtrx X tstr cvs /K X
  62.         S K [ S K known { S K get aload pop } if mtrx ] put
  63.     } repeat
  64. } B
  65. /Place {
  66.     tstr cvs /K X
  67.     S K known {
  68.         bind /proc X tM CM pop
  69.         CP /cY X /cX X
  70.         0 0 transform idtransform neg /aY X neg /aX X
  71.         S K get dup length /maxiter X
  72.         /iter 1 def {
  73.             iter maxiter ne { /saver save def } if
  74.             tM setmatrix aX aY translate
  75.             [ exch aload pop idtransform ] concat
  76.             cX neg cY neg translate cX cY moveto
  77.             /proc load OE
  78.             iter maxiter ne { saver restore /iter iter 1 add def } if
  79.         } forall
  80.         /noXY { CP /cY X /cX X } stopped def
  81.         tM setmatrix noXY { newpath } { cX cY moveto } ifelse
  82.     } {
  83.         Hide OE Unhide
  84.     } ifelse
  85. } B
  86. /normalize {
  87.     2 index dup mul 2 index dup mul add sqrt div
  88.     dup 4 -1 roll exch mul 3 1 roll mul
  89. } B
  90. /replace {
  91.     aload pop MD
  92.     CP /bY X /lX X gsave sM setmatrix
  93.     str stringwidth abs exch abs add dup 0 eq
  94.         { pop } { 360 exch div dup scale } ifelse
  95.     lX neg bY neg translate newpath lX bY moveto
  96.     str { /ch X ( ) dup 0 ch put false charpath ch Kproc } forall
  97.     flattenpath pathbbox [ /uY /uX /lY /lX ] MD
  98.     CP grestore moveto
  99.     currentfont /FontMatrix get dstFM copy dup
  100.     0 get 0 lt { uX lX /uX X /lX X } if
  101.     3 get 0 lt { uY lY /uY X /lY X } if
  102.     /cX uX lX add 0.5 mul def
  103.     /cY uY lY add 0.5 mul def
  104.     debugMode { gsave 0 setgray 1 setlinewidth
  105.         lX lY moveto lX uY lineto uX uY lineto uX lY lineto closepath
  106.         lX bY moveto uX bY lineto lX cY moveto uX cY lineto
  107.         cX lY moveto cX uY lineto stroke
  108.     grestore } if
  109.     dstFM dup invertmatrix dstM CM srcM
  110.     2 { dstM concatmatrix } repeat pop
  111.     getrepl /temp X
  112.         S str convert get {
  113.             aload pop [ /rot /scl /loc /K ] MD
  114.             /aX cX def /aY cY def
  115.             loc {
  116.                 dup 66  eq { /aY bY def } { % B
  117.                 dup 98  eq { /aY lY def } { % b
  118.                 dup 108 eq { /aX lX def } { % l
  119.                 dup 114 eq { /aX uX def } { % r
  120.                 dup 116 eq { /aY uY def }   % t
  121.                 if } ifelse } ifelse } ifelse } ifelse pop
  122.             } forall
  123.             K srcFM rot tM rotate dstM
  124.             2 { tM concatmatrix } repeat aload pop pop pop
  125.             2 { scl normalize 4 2 roll } repeat
  126.             aX aY transform
  127.             /temp temp 7 add def
  128.         } forall
  129.     temp setrepl
  130. } B
  131. /Rif {
  132.     S 3 index convert known { pop replace } { exch pop OE } ifelse
  133. } B
  134. /XA { bind [ /Kproc /str } B /XC { ] 2 array astore def } B
  135. /xs   { pop } XA XC
  136. /xks  { /kern load OE } XA /kern XC
  137. /xas  { pop ax ay rmoveto } XA /ay /ax XC
  138. /xws  { c eq { cx cy rmoveto } if } XA /c /cy /cx XC
  139. /xaws { ax ay rmoveto c eq { cx cy rmoveto } if }
  140.     XA /ay /ax /c /cy /cx XC
  141. /raws { xaws { awidthshow } Rif } B
  142. /rws  { xws { widthshow } Rif } B
  143. /rks  { xks { kshow } Rif } B
  144. /ras  { xas { ashow } Rif } B
  145. /rs   { xs { show } Rif } B
  146. /rrs { getrepl dup 2 add -1 roll //restore exec setrepl } B
  147. PSfragDict begin
  148. islev2 not { /restore { /rrs PSfrag } B } if
  149. /show       { /rs   PSfrag } B
  150. /kshow      { /rks  PSfrag } B
  151. /ashow      { /ras  PSfrag } B
  152. /widthshow  { /rws  PSfrag } B
  153. /awidthshow { /raws PSfrag } B
  154. end PSfragDict RO pop
  155. end
  156.